<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
     <!-- <el-form-item prop="deptId">
        <treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="部门"
          style="width: 480px" size="small" />
      </el-form-item> -->
      <el-form-item prop="storeId">
        <!-- <treeselect v-model="queryParams.storeId" :options="storeOptions" :show-count="true" placeholder="请选择仓库"
          style="width: 480px" size="mini"/> -->
          <el-select v-model="queryParams.storeId" placeholder="仓库" clearable size="small">
              <el-option v-for="dict in storeOptions" :key="dict.id" :label="dict.label"
                :value="dict.id" />
            </el-select>
      </el-form-item>

      <el-form-item prop="dealNo">
        <el-input v-model="queryParams.dealNo" placeholder="处置编号" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>

      <!-- <el-form-item prop="operator">
        <el-select v-model="queryParams.operator" placeholder="处置人" size="small">
          <el-option v-for="item in userOptions" :key="item.userId" :label="item.nickName" :value="item.userId" />
        </el-select>
      </el-form-item> -->

      <el-form-item>
        <el-date-picker v-model="daterangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
          type="daterange" range-separator="-" start-placeholder="创建起始日期" end-placeholder="截止日期"></el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        <!-- <el-button v-if="queryParams.isCheck == '1'" type="warning" icon="el-icon-edit" size="mini" @click="handleTask" :disabled="multiple">处置登记</el-button> -->
      </el-form-item>
    </el-form>

    <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['wms:deal:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['wms:deal:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['wms:deal:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['wms:deal:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->
    <el-row v-if="showTabs">
      <el-col :span="16" class="mb10">
        <el-radio-group v-model="queryParams.isCheck" @change="radioChange">
          <el-radio-button v-for="tab in tabs" :label="tab.label" >
            <el-badge :value="tab.badge" class="item">
              {{tab.name}}
            </el-badge>
          </el-radio-button>
        </el-radio-group>
      </el-col>
    </el-row>

    <el-table v-loading="loading" :data="dealList" @selection-change="handleSelectionChange" border stripe>
      <el-table-column :type="queryParams.isCheck == '1'?'selection':'index'" width="55" align="center" fixed="left" />
      <el-table-column label="处置编号" prop="dealNo" align="center" width="240" fixed="left" />
        <!-- <template slot-scope="scope">
          <el-link type="primary" @click="handleInfo(scope.row)">{{scope.row.dealNo}}</el-link>
        </template> -->
      <!-- </el-table-column> -->
      <el-table-column label="物品名称" prop="proName" min-width="200"/>
      <el-table-column label="库区" prop="areaName" min-width="110" />
      <el-table-column label="库位" prop="locatorName" min-width="260" />
      <el-table-column label="处置单位" prop="handleUnitName" min-width="260">
        <template slot-scope="scope">
          {{scope.row.handleUnitName?scope.row.handleUnitName:scope.row.deptName}}
        </template>
      </el-table-column>
      <el-table-column label="协助单位" prop="helpUnitName" min-width="260"/>
      <el-table-column label="裁决单位" prop="officeName" min-width="260"/>
      <!-- <el-table-column label="处置人"  align="center" prop="nickName" width="120"/> -->
      <el-table-column label="处置意见" align="center" prop="dealType" width="150">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.deal_type" :value="scope.row.dealType" />
        </template>
      </el-table-column>
      <!-- <el-table-column label="属性认定" align="center" prop="believe" width="150">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.deal_believe" :value="scope.row.believe" />
        </template>
      </el-table-column> -->
      <el-table-column label="状态" align="center" prop="memo"  width="80">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.wms_pick_task_status" :value="scope.row.isFinish" />
        </template>
      </el-table-column>
     <!-- <el-table-column label="审核状态" align="center" prop="memo"  width="100">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.deal_check_status" :value="scope.row.isCheck" />
        </template>
      </el-table-column> -->
      <el-table-column label="备注" prop="memo" min-width="280"/>
     <!-- <el-table-column label="文书" prop="wsPdf" min-width="80">
        <template slot-scope="scope">
          <template v-for="item in scope.row.pdfList">
            <el-link type="primary"  target="_blank" :href="getPdfUrl(item)">{{getPdfName(item)}}</el-link>
          </template>
        </template>
      </el-table-column> -->
      <el-table-column label="处置登记" align="center" prop="wsPdf" min-width="80" fixed="right">
        <template slot-scope="scope" v-if="scope.row.registerInfo">
          <el-link type="primary"  @click="handleRegister(scope.row)">查看</el-link>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" fixed="right">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit-outline"
            v-hasPermi="['wms:deal:edit']" v-if="scope.row.isCheck == '0' || !scope.row.isCheck" @click="handleCheck(scope.row)">审核</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit-outline"
            v-hasPermi="['wms:deal:edit']" v-if="scope.row.isCheck == '1' && scope.row.sendStatus == '1' && scope.row.isFinish == '0'" @click="handlePick(scope.row)">挑拣</el-button>
        </template>
      </el-table-column>

    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
    <!-- 添加或修改处置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1080px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="110px">
        <el-row :gutter="15">
          <!-- <el-col :span="8">
            <el-form-item label="任务ID" prop="taskId">
              <el-input v-model="form.taskId" placeholder="请输入任务ID" />
            </el-form-item>
          </el-col> -->


          <!-- <el-col :span="8">
            <el-form-item label="处置单编号" prop="dealNo">
              <el-input v-model="form.dealNo" placeholder="请输入处置单编号" />
            </el-form-item>
          </el-col> -->


          <el-col :span="8">
            <el-form-item label="部门" prop="deptId">
              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="机构"
                style="width: 214px" size="small" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="处置人" prop="operator">
              <el-select v-model="form.operator" placeholder="请选择处置人" style="width: 214px">
                <el-option v-for="item in userOptions" :key="item.userId" :label="item.nickName" :value="item.userId" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="处置方式" prop="dealType">
              <el-select v-model="form.dealType" placeholder="请选择处置方式">
                <el-option v-for="dict in dict.type.wms_deal_type" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="描述备注" prop="memo">
              <el-input v-model="form.memo" type="textarea" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :offset="2" :span="22">
            <el-card shadow="hover">
              <div slot="header" class="clearfix">
                <span>处置清单</span>
                <el-button type="text" style="float:right;padding: 3px 0" @click="addDtl">新增</el-button>
              </div>
              <el-table :data="form.items" border stripe>
                <el-table-column label="物品编号" align="center" prop="pno">
                  <template slot-scope="scope">
                    <el-input placeholder="请输入物品编号" v-model="scope.row.pno" />
                  </template>
                </el-table-column>
                <el-table-column label="物品名称" align="center" prop="name">
                  <template slot-scope="scope">
                    <el-input placeholder="请输入物品名称" v-model="scope.row.name" />
                  </template>
                </el-table-column>
                <!-- <el-table-column label="所在单位" align="center" prop="deptId">
                  <template slot-scope="scope">
                    <treeselect v-model="scope.row.deptId" :options="deptOptions" :show-count="true" append-to-body
                      placeholder="所在单位" size="small" z-index="9999" />
                  </template>
                </el-table-column>
                <el-table-column label="所在机构" align="center" prop="orgId">
                  <template slot-scope="scope">
                    <treeselect v-model="scope.row.orgId" :options="deptOptions" :show-count="true" append-to-body
                      placeholder="所在机构" size="small" z-index="9999" />
                  </template>
                </el-table-column> -->
                <el-table-column label="数量" align="center" prop="nums">
                  <template slot-scope="scope">
                    <el-input placeholder="请输入数量" v-model="scope.row.nums" />
                  </template>
                </el-table-column>
                <el-table-column label="处置方式" align="center" prop="nums">
                  <template slot-scope="scope">
                    <el-select v-model="scope.row.dealType" placeholder="请选择处置方式">
                      <el-option v-for="dict in dict.type.wms_deal_type" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-row>
                      <el-col>
                        <el-button type="danger" size="mini" @click="dtlDel(scope)" v-if="scope.row.delFlag == '0'">删除
                        </el-button>
                        <el-tag type="info" v-if="scope.row.delFlag == '2'">已删除</el-tag>
                      </el-col>
                    </el-row>
                  </template>
                </el-table-column>
              </el-table>
            </el-card>
          </el-col>
        </el-row>

        <!-- <el-row :gutter="15">
          <el-col>
            <el-form-item label="状态" prop="status">
              <el-select v-model="form.status" placeholder="请选择状态" style="width: 214px">
                <el-option v-for="dict in dict.type.wms_deal_status" :key="dict.value" :label="dict.label"
                  :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row> -->



        <el-row :gutter="15" style="margin-top: 15px;">
          <el-col>
            <el-form-item label="图片附件" prop="pics">
              <image-upload v-model="form.pics" ref="imageUpload"></image-upload>
            </el-form-item>
          </el-col>


          <!-- <el-col :span="8">
            <el-form-item label="交接信息" prop="handId">
              <el-input v-model="form.handId" placeholder="请输入交接信息" />
            </el-form-item>
          </el-col> -->



        </el-row>
      </el-form>
      <selectProperty  ref="elDrawer" @handleSelected="handleSelected"></selectProperty>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-drawer :visible.sync="update" title="处置单详情" size="70%">
      <div style="margin:0px 10px 15px 10px;" class="clearfix">
          <span style="font-size: 20px;">{{form.dealNo}}</span>
          <div style="float: right;">
            <el-button type="primary" size="mini" @click="handleUpdate">编辑</el-button>
            <!-- <el-button  size="mini" @click="handlePick(form.id)">挑拣</el-button> -->
            <el-button type="danger" size="mini" @click="handleDelete(form)">删除</el-button>
          </div>
      </div>
      <el-card>
        <el-tabs value="1">
          <el-tab-pane label="表单信息" name="1">
            <el-card>
              <el-descriptions title="基本信息" :column="3" border>
                <el-descriptions-item label="处置单号">{{form.dealNo}}</el-descriptions-item>
                <el-descriptions-item label="申请编号">{{form.taskNo}}</el-descriptions-item>
                <el-descriptions-item label="所属部门">{{form.deptName}}</el-descriptions-item>
                <el-descriptions-item label="姓名">{{form.nickName}}</el-descriptions-item>
                <el-descriptions-item label="联系方式">{{form.phonenumber}}</el-descriptions-item>
                <el-descriptions-item label="处置仓库">{{form.storeName}}</el-descriptions-item>
                <el-descriptions-item label="处置方式">
                  <dict-tag :options="dict.type.wms_deal_type" :value="form.dealType" />
                </el-descriptions-item>
                <el-descriptions-item label="附件">
                  <template v-if="form.pics">
                    <el-image v-for="pic in form.pics.split(',')"
                      style="width: 120px; height: 60px;margin-right: 5px;" :src="pic" fit="scale-down"
                      :preview-src-list="form.pics.split(',')"></el-image>
                  </template>
                </el-descriptions-item>
              </el-descriptions>
            </el-card>
          </el-tab-pane>
          <el-tab-pane label="财物清单" name="2">
            <el-card shadow="hover" style="margin-top: 10px;">
              <div slot="header" class="clearfix">
                <span>财物清单</span>
              </div>
              <el-table :data="form.items"  border stripe>
                <el-table-column label="物品编号" align="center" prop="pno">
                  <template slot-scope="scope">
                    <span>{{scope.row.pno}}</span>
                  </template>
                </el-table-column>
                <el-table-column label="物品名称" align="center" prop="name">
                  <template slot-scope="scope">
                    <span>{{scope.row.name}}</span>
                  </template>
                </el-table-column>
                <el-table-column label="处置方式" align="center" prop="dealType">
                  <template slot-scope="scope">
                   <dict-tag :options="dict.type.wms_deal_type" :value="scope.row.dealType" />
                  </template>
                </el-table-column>
                <el-table-column label="数量" align="center" prop="nums">
                  <template slot-scope="scope">
                    <span>{{scope.row.nums}}</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-card>
          </el-tab-pane>
          <el-tab-pane label="操作日志" name="3">
            <el-table :data="logOptions">
              <el-table-column label="操作人" prop="operator" />
              <el-table-column label="操作时间" prop="logTime" />
              <el-table-column label="动作" prop="content" />
            </el-table>
          </el-tab-pane>
          <!-- <el-tab-pane label="挑拣任务" name="3" v-if="pickOptions">
            <el-descriptions title="基本信息" :column="3" border style="margin-top: 15px;">
             <el-descriptions-item label="任务编号">{{pickOptions.pickNo}}</el-descriptions-item>
             <el-descriptions-item label="挑拣员">{{pickOptions.nickName}}</el-descriptions-item>
             <el-descriptions-item label="状态">
               <dict-tag :options="dict.type.wms_pick_task_status" :value="pickOptions.status" />
             </el-descriptions-item>
            </el-descriptions>
            <el-card style="margin-top: 15px;">
              <div slot="header" class="clearfix">
                <span>物品清单</span>
              </div>
              <el-table :data="pickOptions.items">
                <el-table-column label="编号" prop="pno" />
                <el-table-column label="名称" prop="name" />
                <el-table-column label="数量" prop="nums" />
                <el-table-column label="状态" prop="nums">
                  <template slot-scope="scope">
                    <dict-tag :options="dict.type.wms_pick_task_status" :value="scope.row.status" />
                  </template>
                </el-table-column>
              </el-table>
            </el-card>
          </el-tab-pane> -->
        </el-tabs>
      </el-card>
    </el-drawer>
    <el-drawer :visible.sync="checkShow" size="30%">
      <div class="mainDiv">
        <el-container class="main_container">
          <el-main>
            <el-descriptions class="margin-top" title="审核" :column="1" border>
                <el-descriptions-item label="编号">{{form.dealNo}}</el-descriptions-item>
                <el-descriptions-item label="物品名称">{{form.proName}}</el-descriptions-item>
                <el-descriptions-item label="处置数">{{form.nums}}</el-descriptions-item>
                <el-descriptions-item label="库区">{{form.areaName}}</el-descriptions-item>
                <el-descriptions-item label="处置类型">
                  <dict-tag :options="dict.type.deal_type" :value="form.dealType" />
                </el-descriptions-item>
                <el-descriptions-item label="处置单位">{{form.handleUnitName?form.handleUnitName:form.deptName}}</el-descriptions-item>
                <el-descriptions-item label="协助单位">{{form.helpUnitName}}</el-descriptions-item>
                <el-descriptions-item label="裁决单位">{{form.officeName}}</el-descriptions-item>
                <el-descriptions-item label="处置原因">{{form.memo}}</el-descriptions-item>
                <el-descriptions-item label="文书">
                  <template v-for="item in form.pdfList">
                    <el-link type="primary"  target="_blank" :href="getPdfUrl(item)">{{getPdfName(item)}}</el-link>
                  </template>
                </el-descriptions-item>
            </el-descriptions>
            <el-card class="mt20" shadow="never">
              <div slot="header" class="clearfix">
                <span>审核信息</span>
              </div>
              <el-form ref="form" :model="form" :rules="rules" >
                <el-form-item prop="isCheck">
                   <el-radio-group v-model="form.isCheck">
                      <el-radio :label="1">审核通过</el-radio>
                      <el-radio :label="2">审核不通过</el-radio>
                    </el-radio-group>
                </el-form-item>
              </el-form>
            </el-card>
          </el-main>
          <el-footer class="footerDivClass">
            <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancelCheck">取 消</el-button>
          </el-footer>
        </el-container>
      </div>
    </el-drawer>
    <el-drawer :visible.sync="isInfo" size="30%">
      <div class="mainDiv">
        <el-container class="main_container">
          <el-main>
            <el-descriptions class="margin-top" title="审核" :column="1" border>
                <el-descriptions-item label="编号">{{form.dealNo}}</el-descriptions-item>
                <el-descriptions-item label="物品名称">{{form.proName}}</el-descriptions-item>
                <el-descriptions-item label="处置类型">
                  <dict-tag :options="dict.type.deal_type" :value="form.dealType" />
                </el-descriptions-item>
                <el-descriptions-item label="处置数量">{{registerInfo.disposalNumber}}</el-descriptions-item>
                <template v-if="registerInfo.disposalStat == '1' || registerInfo.disposalStat == '2' || registerInfo.disposalStat == '3' || registerInfo.disposalStat == '6' ">
                  <el-descriptions-item label="处置人">{{registerInfo.dealPerson}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1' || registerInfo.disposalStat == '2' || registerInfo.disposalStat == '3' || registerInfo.disposalStat == '6' ">
                  <el-descriptions-item label="处置单位">{{registerInfo.dealOrg}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1'">
                  <el-descriptions-item label="缴款单据凭证号">{{registerInfo.conVoNo}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1'">
                  <el-descriptions-item label="缴存账户">{{registerInfo.depAcc}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1'">
                  <el-descriptions-item label="银行凭证号">{{registerInfo.accountVoNo}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1'">
                  <el-descriptions-item label="涉案钱款">{{registerInfo.proPrice}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1'">
                  <el-descriptions-item label="变现钱款">{{registerInfo.dealPrice}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1'">
                  <el-descriptions-item label="总金额">{{registerInfo.totalAmount}}</el-descriptions-item>
                </template>
                <template>
                  <el-descriptions-item :label="form.disposalStat == '1'?'上缴日期'
                  :(form.disposalStat == '4'?'变卖时间'
                  :(form.disposalStat == '5'?'拍卖时间'
                  :(form.disposalStat == '8'?'出售时间'
                  :(form.disposalStat == '9'?'变现时间'
                  :(form.disposalStat == '11'?'审前返还日期':'处置时间')))))"
                  >{{registerInfo.dealDate}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '2'">
                  <el-descriptions-item label="保存地点">{{registerInfo.custodianPlace}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '3'">
                  <el-descriptions-item label="返还当事人姓名">{{registerInfo.retPersonName}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '3'">
                  <el-descriptions-item label="返还当事人身份证号码">{{registerInfo.vretPersonCert}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '3'">
                  <el-descriptions-item label="是否认领">{{registerInfo.isClaim}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '3'">
                  <el-descriptions-item label="认领日期">{{registerInfo.claimDate}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '3'">
                  <el-descriptions-item label="委托接收人姓名">{{registerInfo.retPrinName}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '3'">
                  <el-descriptions-item label="委托接收人身份证号码">{{registerInfo.retPrinCert}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '3'">
                  <el-descriptions-item label="返还日期">{{registerInfo.retDate}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '11'">
                  <el-descriptions-item label="审前返还对象">{{registerInfo.retPerson}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '11' || registerInfo.disposalStat == '3'">
                  <el-descriptions-item :label="form.disposalStat == '3'?'返还原因':'审前返还原因'">{{registerInfo.retReason}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5'">
                  <el-descriptions-item :label="form.disposalStat == '4'?'变卖保留价':'拍卖保留价'">{{registerInfo.floorPrice}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8'">
                  <el-descriptions-item :label="form.disposalStat == '4'?'变卖成交价'
                  :(form.disposalStat == '5'?'拍卖成交价'
                  :(form.disposalStat == '8'?'出售金额':'变现金额'))"
                  >{{registerInfo.dealPrice}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8'">
                  <el-descriptions-item :label="form.disposalStat == '4'?'变卖机构'
                  :(form.disposalStat == '5'?'拍卖机构'
                  :(form.disposalStat == '8'?'出售机构':'变现机构'))"
                  >{{registerInfo.dealOrg}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5'">
                  <el-descriptions-item :label="form.disposalStat == '4'?'变卖时当事人是否到场':'拍卖时当事人是否到场'">{{registerInfo.dealIsPresent}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8' || registerInfo.disposalStat == '9' ">
                  <el-descriptions-item label="存入账户">{{registerInfo.depAcc}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8' || registerInfo.disposalStat == '9' || registerInfo.disposalStat == '11' ">
                  <el-descriptions-item :label="registerInfo.disposalStat == '11'?'审前返还处置人':'存入人'">{{registerInfo.dealPerson}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8' || registerInfo.disposalStat == '9' ">
                  <el-descriptions-item label="账户单位">{{registerInfo.accountOrg}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8' || registerInfo.disposalStat == '9' ">
                  <el-descriptions-item label="存款银行">{{registerInfo.accountBank}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8' || registerInfo.disposalStat == '9' ">
                  <el-descriptions-item label="存入日期">{{registerInfo.depDate}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '4' || registerInfo.disposalStat == '5' || registerInfo.disposalStat == '8' || registerInfo.disposalStat == '9' ">
                  <el-descriptions-item label="定期活期">{{registerInfo.accountType}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '6'">
                  <el-descriptions-item label="销毁人">{{registerInfo.destoryPerson}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '6'">
                  <el-descriptions-item label="销毁时间">{{registerInfo.conVoNo}}</el-descriptions-item>
                </template>
                <template v-if="registerInfo.disposalStat == '1' || registerInfo.disposalStat == '2' || registerInfo.disposalStat == '3' || registerInfo.disposalStat == '6' ">
                  <el-descriptions-item label="裁决说明">{{registerInfo.refrereeDesc}}</el-descriptions-item>
                </template>
            </el-descriptions>
          </el-main>
          <el-footer class="footerDivClass">
            <el-button @click="cancelInfo">返 回</el-button>
          </el-footer>
        </el-container>
      </div>
    </el-drawer>
  </div>
</template>

<script>
  import {
    listDeal,
    getDeal,
    delDeal,
    addDeal,
    updateDeal
  } from "@/api/wms/deal";
  import {
    listStore,
    storeTreeselect
  } from "@/api/wms/store";
  import {
    storeAreas
  } from "@/api/wms/storeArea";
  import {
    locatores
  } from "@/api/wms/locator";
  import {
    treeselect
  } from "@/api/system/dept";
  import {
    listUser
  } from "@/api/system/user"
  import {listOperatorLog} from "@/api/oms/operatorLog"
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  import selectProperty from "@/components/SelectProperty/index.vue";
  export default {
    name: "Deal",
    dicts: ['wms_deal_status', 'sys_del_flag', 'wms_deal_type','deal_type','wms_pick_task_status','deal_check_status','deal_believe'],
    components: {
      Treeselect,
      selectProperty
    },
    data() {
      return {
        // 按钮loading
        buttonLoading: false,
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 处置表格数据
        dealList: [],
        storeOptions: [],
        userOptions: [],
        storeTree: [],
        storeName: undefined,
        deptOptions: [],
        storeAreaOptions: [],
        storeAreas: [],
        locatorOptions: [],
        locators: [],
        logOptions:[],
        defaultProps: {
          children: "children",
          label: "label"
        },
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        update:false,
        checkShow:false,
        isInfo:false,
        // 交接信息时间范围
        daterangeCreateTime: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          taskId: undefined,
          dealNo: undefined,
          deptId: undefined,
          operator: undefined,
          status: undefined,
          handId: undefined,
          createTime: undefined,
          createBy: undefined,
          delFlag: "0",
          isCheck:this.$router.currentRoute.query.isCheck||undefined
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
          // taskId: [{
          //   required: true,
          //   message: "任务ID不能为空",
          //   trigger: "blur"
          // }],
          // dealNo: [{
          //   required: true,
          //   message: "处置单编号不能为空",
          //   trigger: "blur"
          // }],
          // deptId: [{
          //   required: true,
          //   message: "部门ID不能为空",
          //   trigger: "blur"
          // }],
          // operator: [{
          //   required: true,
          //   message: "处置人ID不能为空",
          //   trigger: "blur"
          // }],
        },
        tabs:[
          {label:undefined,name:'全部',badge:undefined,value:undefined},
          {label:'0',name:'待审核',badge:undefined,value:'0'},
          {label:'1',name:'审核通过',badge:undefined,value:'1'},
          {label:'2',name:'审核未通过',badge:undefined,value:'2'}
        ],
        showTabs:true,
        registerInfo:{}
      };
    },
    watch: {
      storeName(val) {
        this.$refs.tree.filter(val);
      },
      'queryParams.deptId': {
        handler(newVal, oldVal) {
          this.deptChange();
        },
        deep: true,
        immediate: true
      }
    },
    mounted() {
      if(this.$router.currentRoute.query.isCheck && this.$router.currentRoute.query.isCheck == '1'){
        this.showTabs = false;
      }
    },
    created() {
      this.getList();
      this.getStoreTreeselect();
      this.getTreeselect();
      this.getUsers();
      this.getAreaAndLocators();
    },
    methods: {
      radioChange(e){
        this.tabs.forEach(item=>{
            if(item.label == e){
              this.queryParams.isCheck = item.value;
            }
        })
        this.getList();
      },
      /** 查询处置列表 */
      getList() {
        this.loading = true;
        this.queryParams.params = {};
        if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
          this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
          this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
        }
        listDeal(this.queryParams).then(response => {
          this.dealList = response.rows;
          this.total = response.total;
          this.loading = false;
          this.tabs.forEach((item)=>{
          	if(item.value == this.queryParams.isCheck){
          		item.badge = this.total;
          	}else{
          		item.badge = undefined;
          	}
          })
        });

      },
      getLogs(id){
        listOperatorLog({"objid":id,"logType":"wms"}).then(response=>{
          this.logOptions = response.rows;
        })
      },
      /** 查询分类下拉树结构 */
      getStoreTreeselect() {
        storeTreeselect().then(response => {
          this.storeOptions = response.data;
        });
      },
      getAreaAndLocators() {
        storeAreas({
          "storeId": this.queryParams.storeId
        }).then(response => {
          this.storeAreaOptions = response.data;
        });
        locatores({
          "storeId": this.queryParams.storeId
        }).then(response => {
          this.locatorOptions = response.data;
        });
      },
      /** 查询部门下拉树结构 */
      getTreeselect() {
        treeselect().then(response => {
          this.deptOptions = response.data;
        });
      },
      getUsers() {
        listUser({
          'userType': 'sys_user',
          'deptId': this.queryParams.deptId
        }).then(response => {
          this.userOptions = response.rows
        })
      },
      deptChange() {
        this.getUsers()
        this.getList();
      },
      // 筛选节点
      filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      },
      // 节点单击事件
      handleNodeClick(data) {
        this.queryParams.storeId = data.id;
        this.handleQuery();
        this.getAreaAndLocators()
      },
      normalizer(node) {
        if (node.children && !node.children.length) {
          delete node.children;
        }
        return {
          id: node.id,
          label: node.name,
          children: node.children
        };
      },
      // 取消按钮
      cancel() {
        this.open = false;
        // this.reset();
      },
      cancelCheck(){
        this.checkShow = false;
      },
      cancelInfo(){
        this.isInfo = false;
      },
      // 表单重置
      reset() {
        this.form = {
          id: undefined,
          taskId: undefined,
          dealNo: undefined,
          deptId: undefined,
          operator: undefined,
          status: undefined,
          memo: undefined,
          pics: undefined,
          handId: undefined,
          createTime: undefined,
          createBy: undefined,
          updateTime: undefined,
          updateBy: undefined,
          delFlag: undefined,
          items: []
        };
        this.resetForm("form");
      },
      addDtl() {
        // let data = {
        //   id: undefined,
        //   dealId: undefined,
        //   pno: undefined,
        //   name: undefined,
        //   nums: undefined,
        //   dealType: undefined,
        //   pics: undefined,
        //   status: undefined,
        //   createTime: undefined,
        //   createBy: undefined,
        //   updateTime: undefined,
        //   updateBy: undefined,
        //   storeId: undefined,
        //   locatorId: undefined,
        //   areaId: undefined,
        //   delFlag: '0'
        // }
        // this.form.items.push(data)
        this.$refs.elDrawer.open()
      },
      dtlDel(scope) {
        let index = scope.$index;
        if (this.form.items[index].id && this.form.items[index].id != '') {
          this.form.items[index].delFlag = '2';
        } else {
          this.form.items.splice(index, 1)
        }
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.daterangeCreateTime = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id)
        this.single = selection.length !== 1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.title = "添加处置";
        this.form.storeId = this.queryParams.storeId;
        this.getAreaAndLocators();
        // this.$router.push({
        //   path: '/wms/dealInfo/add',
        //   query: {
        //     pageNum: this.queryParams.pageNum
        //   }
        // })
      },
      handleInfo(row){
        this.update = true;
        const id = row.id || this.ids
        getDeal(id).then(response => {
          this.form = response.data;
        });
        this.getLogs(row.taskId ? row.taskId:id)
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        // this.loading = true;
        // this.reset();
        // this.getAreaAndLocators();
        // const id = row.id || this.ids
        // getDeal(id).then(response => {
        //   this.loading = false;
        //   this.form = response.data;
        //   this.open = true;
        //   this.title = "修改处置";
        // });
        this.open = true;
        this.title = "修改处置单";
        this.$refs.elDrawer.getList();
      },
      handleCheck(row){
        if(row.nums == 0){
          this.$modal.msgWarning("物品不在库，无法审核！");
        }else{
          const id = row.id || this.ids
          getDeal(id).then(response=>{
            this.form = response.data;
            this.checkShow = true;
          })
        }

      },
      handlePick(row){
        const id = row.id || this.ids;
        this.$router.push({
          path: '/wms/dealInfo/pick/'+row.id,
          query: {
            pageNum: this.queryParams.pageNum
          }
        })
      },
      handleRegister(row){
        this.isInfo = true;
        const id = row.id || this.ids
        getDeal(id).then(response => {
          this.form = response.data;
          this.registerInfo = JSON.parse(response.data.registerInfo);
        });
      },
      handleTask(row){
        const id = row.id || this.ids;
        console.info('id===>',id)
        this.$router.push({
          path: '/oms/dealInfo/addDeal',
          query: {
            pageNum: this.queryParams.pageNum,
            ids:id
          }
        })
      },
      //获取选择后的财务数据
        handleSelected(array){
          array.forEach(item=>{
            item.delFlag = '0'
            item.id=undefined
            this.form.items.push(item)
          })
        },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          // this.form.oss = this.$refs["imageUpload"].pics;
          if (valid) {
            if (this.form.id != null) {
              if(this.form.isCheck == '0'){
                this.$modal.msgWarning("请选择审核状态");
                return false;
              }
              this.buttonLoading = true;
              updateDeal(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.checkShow = false;
                this.getList();
              }).finally(() => {
                this.buttonLoading = false;
              });
            } else {
              addDeal(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.checkShow = false;
                this.getList();
              }).finally(() => {
                this.buttonLoading = false;
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const ids = row.id || this.ids;
        this.$modal.confirm('是否确认删除处置编号为"' + ids + '"的数据项？').then(() => {
          this.loading = true;
          return delDeal(ids);
        }).then(() => {
          this.loading = false;
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).finally(() => {
          this.loading = false;
        });
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('wms/deal/export', {
          ...this.queryParams
        }, `deal_${new Date().getTime()}.xlsx`)
      },
      getPdfName(fileUrl){
          let files = fileUrl.split('/');
          let _names = files[files.length-1];
          let fileName = _names;
          if(_names && _names.indexOf("_") != -1){
            let fileNames = _names.split("_");
            fileName = fileNames[fileNames.length - 1];
          }
          return '查看';
      },
      getPdfUrl(fileUrl){
          let markParams = {
            "text":"三明市安保信息科技有限公司",
            "fontSize":"20",
            "color":"rgba(128,128,128,0.6)",
            "rotate":"330",
            "Place":"middleCenter",
            "Rule":"all",
            "tiling":"false",
            "fontName":"SimSun",
            "distanceX":"10",
            "distanceY":"10"
        }
        let host = location.hostname;
        if(host == '192.168.1.256'){host = host.replace('192.168.1.256','192.168.1.241')}
        if(host == '192.168.1.246'){host = host.replace('192.168.1.246','192.168.1.241')}
        if(host == '10.49.241.156'){host = host.replace('10.49.241.156','10.49.241.151')}
        let origin = location.protocol+'//'+host;
        let url = origin+':8095/reader?file='+fileUrl+'&markParams='+encodeURIComponent(JSON.stringify(markParams));
        return url;
      }
    }
  };
</script>
